package com.jspxcms.plug.repository;

import com.jspxcms.common.orm.Limitable;
import com.jspxcms.plug.domain.PlugHospitalDepartment;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.Collection;
import java.util.List;

public interface PlugHospitalDepartmentDao extends Repository<PlugHospitalDepartment, Integer>, PlugHospitalDepartmentDaoPlus {
	public Page<PlugHospitalDepartment> findAll(Specification<PlugHospitalDepartment> spec, Pageable pageable);

	public List<PlugHospitalDepartment> findAll(Specification<PlugHospitalDepartment> spec, Limitable limitable);

	public PlugHospitalDepartment findOne(Integer id);

	public PlugHospitalDepartment save(PlugHospitalDepartment bean);

	public void delete(PlugHospitalDepartment bean);

    @Query("from PlugHospitalDepartment a where a.hospital.id = ?1")
    public List<PlugHospitalDepartment> findByHospitalId(Integer hospitalId);
}
